import 'package:ch_router/ch_router.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:lmreader/pages/index.dart';

import 'names.dart';

/// 路由页面
class RoutePages extends RoutesAdaptor {
  /// 注册路由
  @override
  registerRoutes(CHNavigator navigator) {}

  /// 当前模块所有路由
  /// Tabbar根页面路由不需要设置parentNavigatorKey！！！
  @override
  List<RouteBase> allRoutes({GlobalKey<NavigatorState>? navigatorKey}) => [
        GoRoute(
          name: RouteNames.home,
          path: RouteNames.home,
          builder: (context, state) => const HomePage(),
        ),
        GoRoute(
          name: RouteNames.splash,
          path: RouteNames.splash,
          pageBuilder: (context, state) => NoTransitionPage<void>(
            key: state.pageKey,
            child: const SplashPage(),
          ),
          // builder: (context, state) => const SplashPage(),
        ),
        GoRoute(
          name: RouteNames.about,
          path: RouteNames.about,
          builder: (context, state) => const AboutPage(),
        ),
      ];
}
